home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscSoundPalette / MiscSoundViewInspector.m < prev    next >
Encoding:
Text File  |  1995-04-17  |  3.2 KB  |  115 lines

  1. /*
  2.  
  3. Version 1.2
  4. Copyright (c) 1995 by Sean Luke
  5. Donated to the MiscKit
  6.  
  7. Permission to use, copy, modify, and distribute this material 
  8. for any purpose and without fee, under the restrictions as noted 
  9. in the MiscKit copyright notice, is hereby granted, provided that
  10. the MiscKit copyright notice and this permission notice 
  11. appear in all source copies, and that the author's name shall not
  12. be used in advertising or publicity pertaining to this 
  13. material without the specific, prior written permission 
  14. of the author.  SEAN O. LUKE  MAKES NO REPRESENTATIONS ABOUT THE
  15. ACCURACY OR SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  
  16. IT IS PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  17.  
  18. */
  19.  
  20. #import "MiscSoundViewInspector.h"
  21. #import "MiscSoundUtil.subproj/MiscSoundView.h"
  22.  
  23. @implementation MiscSoundViewInspector
  24.  
  25. - init
  26.     {
  27.     char buf[MAXPATHLEN+1];
  28.     id bundle;
  29.     
  30.     [super init];
  31.     bundle=[NXBundle bundleForClass:[MiscSoundView class]];
  32.     [bundle getPath:buf forResource:"MiscSoundViewInspector" ofType:"nib"];
  33.     [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
  34.     return self;
  35.     }
  36.     
  37.  
  38. - ok:sender
  39.     {
  40.     float mi=[minor floatValue];
  41.     int ma=[major intValue];
  42.     int rul;
  43.     int lab;
  44.     int y;
  45.     int z;
  46.     int unit;
  47.     int line;
  48.     int scro;
  49.     
  50.     if ([lines selectedRow])
  51.         {if ([lines selectedCol]) 
  52.             line=MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_DECIBEL;
  53.          else line=MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTY;}
  54.     else
  55.         {if ([lines selectedCol])
  56.             line=MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTYFOUR;
  57.          else line=MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_SIXTEEN;}
  58.          
  59.     scro=[scroll intValue];
  60.     rul=[[display cellAt:0:0] intValue];
  61.     lab=[[display cellAt:1:0] intValue];
  62.     y=[[display cellAt:0:1] intValue];
  63.     z=[[display cellAt:1:1] intValue];
  64.     
  65.     if ([units selectedRow]==0) 
  66.         unit=MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SAMPLES;
  67.     else if ([units selectedRow]==1) 
  68.         unit=MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SECONDS;
  69.     else unit=MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_PERCENT;
  70.          
  71.     if (mi<=0.0){mi=1000.0;[minor setFloatValue:mi];}
  72.     if (ma<=0){ma=10;[major setIntValue:ma];}
  73.     
  74.     [object set:rul:y:lab:z:ma:mi:unit:line:scro];
  75.  
  76.     return [super ok:sender];
  77.     }
  78.     
  79. - revert:sender
  80.     {
  81.     int line=[object yDisplayFormat];
  82.     int unit=[object minorTickSpacingFormat];
  83.     
  84.     [scroll setIntValue:[object scrollToReflectPlaying]];
  85.     [major setIntValue:[object majorTickSpacing]];
  86.     [minor setFloatValue:[object minorTickSpacing]];
  87.     [[display cellAt:0:0] setIntValue:[object xAxisDisplayed]];
  88.     [[display cellAt:1:0] setIntValue:[object labelsDisplayed]];
  89.     [[display cellAt:0:1] setIntValue:[object yAxisDisplayed]];
  90.     [[display cellAt:1:1] setIntValue:[object zeroLineDisplayed]];
  91.     
  92.     if (unit==MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SAMPLES)
  93.         [units selectCellAt:0:0];
  94.     else if (unit==MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SECONDS)
  95.         [units selectCellAt:1:0];
  96.     else [units selectCellAt:2:0];
  97.     
  98.     if (line==MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_SIXTEEN)
  99.         [lines selectCellAt:0:0];
  100.     else if (line==MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTY)
  101.         [lines selectCellAt:1:0];
  102.     else if (line==MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTYFOUR)
  103.         [lines selectCellAt:0:1];
  104.     else [lines selectCellAt:1:1];
  105.         
  106.     return [super revert:sender];
  107.     }
  108.     
  109. - (BOOL) wantsButtons
  110.     {
  111.     return NO;
  112.     }
  113.  
  114. @end
  115.